<template>
  <div id="user-nav" class="flex content-center">
    <el-menu mode="horizontal" class="user-show deep-color a-link-item inherit-bg-color"
             :default-active="activeItem">
      <el-menu-item :index="$rp.ACTIVITIES">
        <router-link :to="{ name: 'UserActivities' }">最新活动</router-link>
      </el-menu-item>
      <el-menu-item :index="$rp.SPACES">
        <router-link :to="{ name: 'UserSpaces' }">加入的空间</router-link>
      </el-menu-item>
      <el-menu-item index="collection">
        <router-link :to="{ name: 'UserCollection' }">收藏</router-link>
      </el-menu-item>
    </el-menu>
  </div>
</template>

<script>
export default {
  name: 'UserNav', // 用户展示界面的导航栏
  computed: {
    // 从url获取当前用户id
    userId() { return this.$route.params.userId; },
    // 从url获取当前激活的用户信息
    activeItem() { return this.$route.path.split('/')[3] || this.$rp.ACTIVITIES; },
  },
};
</script>

<style></style>
